package com.wz.wiki.config;

import com.wz.wiki.interceptor.LogInterceptor;
import com.wz.wiki.interceptor.LoginInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import javax.annotation.Resource;

/**
 * @author 王哲
 * @Contact 1121586359@qq.com
 * @ClassName SpringMvcConfig.java
 * @create 2023年06月29日 下午4:48
 * @Description springmvc的配置类
 * @Version V1.0
 */
@Configuration
public class SpringMvcConfig implements WebMvcConfigurer {

    @Resource
    LoginInterceptor loginInterceptor;

    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(loginInterceptor)
                .addPathPatterns("/**")
                .excludePathPatterns(
                        "/test/**",
                        "/redis/**",
                        "/user/login",
                        "/category/all",
                        "/ebook/list",
                        "/doc/all/**",
                        "/doc/findContent/**",
                        "/doc/vote/**",
                        "/doc/find-content/**",
                        "/ebookSnapshot/**"
                );
    }
}
